/* @INLINE FILE standalone.menu.bloc.js =============================================================
	* Menu functions
	* 
	* VAR
	* menus
    * current_menu_user
    * user_menu
    * avail_menu
    * sig_menu
    * nick_menu
    * var menu_item_style
    * menu_item_exerpt
	*
	* FUNC
	* this.toggleMenu
    * this.createMenu
    * create_user_menu
    * user_menu_content
    * toggle_send_message_menu_item
    * enable_hover
    * this.getMenuStatus
	*/
	
    var menus =[];
    var current_menu_user=0;
    var user_menu=fc_toolbar_style.menus.user_options;
    var avail_menu=fc_toolbar_style.menus.set_availability;
    var sig_menu=fc_toolbar_style.menus.set_signature;
    var nick_menu=fc_toolbar_style.menus.set_nickname;
    var menu_item_style = "style='position:relative;left:0px;"+user_menu.menu_item.dim+"'><div style='"+user_menu.menu_item.css;
    var menu_item_exerpt ="<div class = 'fc_menu_item' " + menu_item_style + "color:"+user_menu.menu_item.link_color+"'>&nbsp;&nbsp;";
	
    this.toggleMenu = function(target,u,name) {
		if (!menus[name] || !menus[name].isOpen) {
			current_menu_user=u,
			this.createMenu(target,name);
		} else {
			menus[name].hide();
		}
		return false;
	};
    this.createMenu = function(target,name) {
		var p,s;
		//s.offsetTop = (w) ? s.offsetTop + 1 : s.offsetTop +3;
		//if(_t.exp6)s.shadow=false;
		if(name=='u1'){
			s = jQ.extend(true, {}, user_menu);
			if(current_menu_user!=_t.uid){
				s.css.height=(EN(s.css.height)-60)+'px';
			}
			menus[name] = create_user_menu(this,s,target,current_menu_user);
		}else if(name=='item2'){
			s = jQ.extend(true, {}, avail_menu);
			menus[name] = this.createWidget('DefaultMenu', [ s,
			        (mobile?"<div style='position:relative;top:"+(EN(avail_menu.css.height)-20)+"px;float:right'><a style='"+avail_menu.menu_item.hide_icon.css+"' HREF='javascript:void' onclick='return fc_chat.toggleMenu(null,null,\"item2\")'>x</a>&nbsp;&nbsp;</div>":"")+
			        "<div style='"+avail_menu.menu_item.css+"'><INPUT TYPE=radio " + (a.bs[current_menu_user]=='1'?'':"checked") + " id='fc_avl1' onclick='fc_chat.setBusy(0);' name='fc_avl'>"+__(348,"Available")+"<br><br>" +
 					"<INPUT TYPE=radio " + (a.bs[current_menu_user]!='1'?'':"checked") + " id='fc_avl2' onclick='fc_chat.setBusy(1);' name='fc_avl'>"+__(349,"Busy")+"</div>",
 					null , jQ(target),
 					p = (menus['u1']&&menus['u1'].isOpen?menus['u1'].frame:jQ(_t.uD)),false,mobile]);
		}else if(name=='item3'){
			s = jQ.extend(true, {}, sig_menu);
			menus[name] = this.createWidget('DefaultMenu', [ s,
			        (mobile?"<div style='position:relative;top:"+(EN(sig_menu.css.height)-20)+"px;float:right'><a style='"+sig_menu.menu_item.hide_icon.css+"' HREF='javascript:void' onclick='return fc_chat.toggleMenu(null,null,\"item3\")'>x</a>&nbsp;&nbsp;</div>":"")+
			        "<div style='"+sig_menu.menu_item.css+"'>"+__(361,"Signature (50 chars max)")+"&nbsp;<form action='javascript:fc_chat.setTagline("+current_menu_user+");'><INPUT TYPE=text value='' maxlength='50' style='margin-top:10px;width:"+(EN(sig_menu.css.width)-24)+"px' id='fc_tagline' name='fc_tagline'></form><div id='fc_tagline_set' style='visibility:hidden;"+sig_menu.menu_item.set_notice.css+"'>"+__(362,'Signature Set')+"</div></div>",
 					null , jQ(target),
 					p = (menus['u1']&&menus['u1'].isOpen?menus['u1'].frame:jQ(_t.uD)),false,mobile]);
		}
	    menus[name].hide = function() {
			this.getDefault().hide.call(this);
			this.getDefault().close.call(this);
	    };
	    menus[name].show();
		return false;
	};
    
	//User Menu
    var create_user_menu = function(_t,s,target,u){
    	var menu = _t.createWidget('DefaultMenu', [ s,
	        user_menu_content(u),                                        
			null , jQ(target),
			p = jQ(document.body),(exp6?0:current_pos),mobile]);
    	enable_hover();
    	return menu;
    };
    var user_menu_content = function(u){
		var a_style = "style='"+user_menu.menu_item.link_css+"' HREF='javascript:void' onclick=";
		 return (mobile?"<div style='position:relative;top:"+(EN(user_menu.css.height)-20)+"px;float:right'>" +
		 					"<a style='"+user_menu.menu_item.hide_icon.css+"' HREF='javascript:void' onclick='return fc_chat.toggleMenu(null,null,\"u1\")'>x</a>" +
		 					"&nbsp;&nbsp;" +
		 				"</div>":"")+
		 				
		 				"<div id='fc_menu_item1'>"+
		 					toggle_send_message_menu_item((isAvl(u)&&u!=_t.uid&&(!is_guest(u)||a.o[u]=='1')?1:0),u)+
		 				"</div>"+
		 				
		 				(!guest&&u==_t.uid?
		 						"<a "+a_style+"'return fc_chat.logout()'>"+
			 						menu_item_exerpt+__(44)+
			 					"</div></div></a>" +
			 					
			 					(u == _t.uid && (a.ac[u] == '1' || a.ac[u] == '2') ?
			 			        	"<a style='"+user_menu.menu_item.link_css+"' HREF='" + _s + "Mod.html'>"+
			 			        	menu_item_exerpt+__(45)+
			 			        	"</div></div></a>" 
			 			         :"") +
			 			         
		 						"<a "+a_style+"\"return fc_chat.toggleMenu(this," + u + ",'item3');\">"+
		 							menu_item_exerpt+__(363,'Set Signature')+
		 						"</div></div></a>" 
		 				:"") +
		 				
		 				(!is_guest(u)&&import_profiles ?
 								"<a style='"+user_menu.menu_item.link_css+"' target=_blank href='"+import_profiles_url+encodeURIComponent(a.nm[u])+"'>"+
 								menu_item_exerpt+__(46)+
 								"</div></div></a>" 
		 				:"") +
		 				
		 				"<a "+a_style+"'return fc_chat.getMenuStatus(" + u + ")'>"+
		 					menu_item_exerpt+__(48)+
		 				"</div></div></a>" +
		 				
		 				(u==_t.uid?
	 						"<a "+a_style+"\"return fc_chat.toggleMenu(this," + u + ",'item2');\">"+
	 							menu_item_exerpt+__(350,'Set Availability')+
	 						"</div></div></a>" +
	 						(is_guest(u)?
	 							"<a "+a_style+"\"return fc_chat.tglNick(1," + u + ");\">"+
		 							menu_item_exerpt+__(422,'Set Nickname')+
		 						"</div></div></a>"
			 				:"")
		 				:
			 				"<a style='"+user_menu.menu_item.link_css+"' HREF='javascript:fc_chat."+(frList[u]=='1'?"remove_friend":"add_friend")+"("+u+");'>"+
			 					menu_item_exerpt+(frList[u]=='1'?__(286,"Remove from Friends"):__(281,"Add to Friends"))+
			 				"</div></div></a>"
		 				);
	};
	var toggle_send_message_menu_item = function(n,u){
		return (n?"<a style='"+user_menu.menu_item.link_css+"' href='javascript:fc_chat.load_respond("+u+")'>"+menu_item_exerpt+__(351,"Send Message")+"</div></div></a>":
					"<div class = 'fc_menu_item_dis' " + menu_item_style + "color:"+user_menu.menu_item.disabled_link_color+"'>&nbsp;&nbsp;"+__(351,"Send Message")+"</div></div>");
	};
	
	var enable_hover = function(){
		jQ('div.fc_menu_item').hover(
	    	function() {
	    		jQ(this).css("background-color",user_menu.menu_item.hover_color)
	    	},
	    	function() {
	    		jQ(this).css("background-color",user_menu.css["background-color"])
	    	}
	   );
	};
	this.getMenuStatus = function(u){
		menus['u1'].hide();
		if(!toggle_new_messages){
			fc_chat.tgl_messages(current_pos);
		}
		return fc_chat.showStatus(u,document);
	};

    //standalone.menu.bloc.js =============================================================@END FILE*/